package com.show.dto.grid;

import com.fasterxml.jackson.annotation.JsonBackReference;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 单元网格
 * Created by yxd on 2018/1/30.
 */
@Entity
public class CellGrid implements Serializable {

    @Id
//    @GenericGenerator(name = "system-uuid", strategy = "uuid")
//    @GeneratedValue(generator = "system-uuid")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "cell_grid_id")
    private int cellGridId; //主键

    @Column(name = "cell_id")
    private String cellId; //单元网格Id

    @ManyToOne(cascade = {CascadeType.REFRESH, CascadeType.MERGE}, optional = true)
    @JoinColumn(name = "grid_id")
    private Grid grid;//责任网格

    public CellGrid() {
        super();
    }

    public CellGrid(String cellId) {
        super();
        this.cellId = cellId;
    }

    public int getCellGridId() {
        return cellGridId;
    }

    public void setCellGridId(int cellGridId) {
        this.cellGridId = cellGridId;
    }

    public String getCellId() {
        return cellId;
    }

    public void setCellId(String cellId) {
        this.cellId = cellId;
    }

    public Grid getGrid() {
        return grid;
    }

    @JsonBackReference
    @NotFound(action = NotFoundAction.IGNORE)
    public void setGrid(Grid grid) {
        this.grid = grid;
    }
}
